/**
 * amis v6.13.0
 * build time: 2025-08-12
 * Copyright 2018-2025 baidu
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _CollapseGroup = require('amis-ui/lib/components/CollapseGroup');
var tslib = require('tslib');
var React = require('react');
var amisCore = require('amis-core');
var cx = require('classnames');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var _CollapseGroup__default = /*#__PURE__*/_interopDefaultLegacy(_CollapseGroup);
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);

var __react_jsx__ = require('react');
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
var _J$F_ = (__react_jsx__["default"] || __react_jsx__).Fragment;


;var CollapseGroupRender = /** @class */function (_super) {
  tslib.__extends(CollapseGroupRender, _super);
  function CollapseGroupRender(props) {
    return _super.call(this, props) || this;
  }
  CollapseGroupRender.prototype.handleCollapseChange = function (activeKeys, collapseId, collapsed) {
    return tslib.__awaiter(this, void 0, void 0, function () {
      var dispatchEvent, renderEvent;
      return tslib.__generator(this, function (_a) {
        switch (_a.label) {
          case 0:
            dispatchEvent = this.props.dispatchEvent;
            return [4 /*yield*/, dispatchEvent('change', amisCore.resolveEventData(this.props, {
              activeKeys: activeKeys,
              collapseId: collapseId,
              collapsed: collapsed
            }))];
          case 1:
            renderEvent = _a.sent();
            if (renderEvent === null || renderEvent === void 0 ? void 0 : renderEvent.prevented) {
              return [2 /*return*/];
            }
            return [2 /*return*/];
        }
      });
    });
  };
  CollapseGroupRender.prototype.render = function () {
    var _a = this.props,
      defaultActiveKey = _a.defaultActiveKey,
      accordion = _a.accordion,
      expandIcon = _a.expandIcon,
      expandIconPosition = _a.expandIconPosition,
      body = _a.body,
      className = _a.className,
      style = _a.style,
      render = _a.render,
      mobileUI = _a.mobileUI,
      data = _a.data,
      id = _a.id,
      themeCss = _a.themeCss,
      wrapperCustomStyle = _a.wrapperCustomStyle,
      env = _a.env;
    var enableFieldSetStyle = this.props.enableFieldSetStyle;
    if (amisCore.isPureVariable(enableFieldSetStyle)) {
      enableFieldSetStyle = amisCore.resolveVariableAndFilter(enableFieldSetStyle, data, '| raw');
    }
    return _J$X_(React__default["default"].Fragment, null, _J$X_(_CollapseGroup__default["default"], {
      defaultActiveKey: defaultActiveKey,
      accordion: accordion,
      expandIcon: expandIcon,
      expandIconPosition: expandIconPosition,
      className: cx__default["default"](className, amisCore.setThemeClassName(tslib.__assign(tslib.__assign({}, this.props), {
        name: 'className',
        id: id,
        themeCss: themeCss
      })), amisCore.setThemeClassName(tslib.__assign(tslib.__assign({}, this.props), {
        name: 'wrapperCustomStyle',
        id: id,
        themeCss: wrapperCustomStyle
      }))),
      style: style,
      mobileUI: mobileUI,
      onCollapseChange: this.handleCollapseChange
    }, render('body', body || '', {
      enableFieldSetStyle: enableFieldSetStyle
    })), _J$X_(amisCore.CustomStyle, tslib.__assign({}, this.props, {
      config: {
        wrapperCustomStyle: wrapperCustomStyle,
        id: id,
        themeCss: themeCss,
        classNames: [{
          key: 'className'
        }]
      },
      env: env
    })));
  };
  CollapseGroupRender.defaultProps = {
    enableFieldSetStyle: true
  };
  tslib.__decorate([amisCore.autobind, tslib.__metadata("design:type", Function), tslib.__metadata("design:paramtypes", [Array, Object, Boolean]), tslib.__metadata("design:returntype", Promise)], CollapseGroupRender.prototype, "handleCollapseChange", null);
  return CollapseGroupRender;
}(React__default["default"].Component);
var CollapseGroupRenderer = /** @class */function (_super) {
  tslib.__extends(CollapseGroupRenderer, _super);
  function CollapseGroupRenderer() {
    return _super !== null && _super.apply(this, arguments) || this;
  }
  CollapseGroupRenderer = tslib.__decorate([amisCore.Renderer({
    type: 'collapse-group'
  })], CollapseGroupRenderer);
  return CollapseGroupRenderer;
}(CollapseGroupRender);

exports.CollapseGroupRender = CollapseGroupRender;
exports.CollapseGroupRenderer = CollapseGroupRenderer;
